﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace iLangl
{
	public class ProjectStatuses
	{
		public enum eStatus
		{
			Unknown = 0,
			Configuration = 2,
			WaitingForQuota = 4,
			ReadyToStart = 8,
			InProgress = 16,
			Cancelled = 32,
			Finished = 64,
			Archived = 128
		}

		public const String Archived = "Archived";
		public const String Cancelled = "Cancelled";
		public const String ReadyToStart = "ReadyToStart";
		public const String Configuration = "Configuration";
		public const String Finished = "Finished";
		public const String InProgress = "InProgress";
		public const String WaitingForQuota = "WaitingForQuota";
		public const String Unknown = "Unknown";

		public static String GetStatus(eStatus status)
		{
			switch (status)
			{
				case eStatus.Archived:
					return Archived;
				case eStatus.Cancelled:
					return Cancelled;
				case eStatus.ReadyToStart:
					return ReadyToStart;
				case eStatus.Configuration:
					return Configuration;
				case eStatus.Finished:
					return Finished;
				case eStatus.InProgress:
					return InProgress;
				case eStatus.WaitingForQuota:
					return WaitingForQuota;
			}

			return "Unknown";
		}

		public static eStatus GetStatus(String status)
		{
			if(string.Compare(Archived, status, true) == 0)
			{
				return eStatus.Archived;
			}

			if(string.Compare(Cancelled, status, true) == 0)
			{
				return eStatus.Cancelled;
			}

			if(string.Compare(Configuration, status, true) == 0)
			{
				return eStatus.Configuration;
			}

			if(string.Compare(Finished, status, true) == 0)
			{
				return eStatus.Finished;
			}

			if(string.Compare(InProgress, status, true) == 0)
			{
				return eStatus.InProgress;
			}

			if(string.Compare(ReadyToStart, status, true) == 0)
			{
				return eStatus.ReadyToStart;
			}

			if (string.Compare(WaitingForQuota, status, true) == 0)
			{
				return eStatus.WaitingForQuota;
			}
			return eStatus.Unknown;
		}
	}
}
